package com.tamtamy.jtta.data.json;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import com.tamtamy.jtta.data.UserStatsGenerationList;
import com.tamtamy.jtta.exception.NoResultException;

public class JSONUserStatsGenerationList extends UserStatsGenerationList {

	private static final long serialVersionUID = 9171042869419160326L;

	public JSONUserStatsGenerationList(JSONObject jsonObject) throws NoResultException{
		super();
		JSONArray userStatsGenerationListJSON = (JSONArray)jsonObject.get("list");
		if (userStatsGenerationListJSON == null || userStatsGenerationListJSON.size()==0){
			throw new NoResultException("No comments found");
		}
		for (int i = 0; i < userStatsGenerationListJSON.size(); i++) {
			JSONObject userStatsGenerationJSON = userStatsGenerationListJSON.getJSONObject(i);
			this.add(new JSONUserStatsGeneration(userStatsGenerationJSON));
		}	
	}
	
}